package insertData;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Random;

public class TestDataGenerator {
    public static void insertTestData(Connection connection, int numRecords) throws SQLException {
        String insertQuery = "INSERT INTO users (name, email) VALUES (?, ?)";
        Random random = new Random();

        try (PreparedStatement preparedStatement = connection.prepareStatement(insertQuery)) {
            for (int i = 0; i < numRecords; i++) {
                preparedStatement.setString(1, "User" + i);
                preparedStatement.setString(2, "user" + i + "@example.com");
                preparedStatement.executeUpdate();
            }
        }
    }
}
